Parameters
- bytes
Library/Library.Test/TestHash.cs
C# | Copy Code |
---|---|
Random r = new Random(); byte[] a = new byte[10], b = new byte[32]; r.NextBytes(a); r.NextBytes(b); Hash h1 = Hash.SHA256(a); Hash h3 = h1.Combine(b); Assert.AreEqual(h3.ToString(), Hash.SHA256( new CombinedStream( new MemoryStream(h1.ToArray()), new MemoryStream(Hash.SHA256(b).ToArray())//bytes combined are hashed first )).ToString()); |
VB.NET | Copy Code |
---|---|
Dim r As New Random() Dim a As Byte() = New Byte(10) {}, b As Byte() = New Byte(32) {} r.NextBytes(a) r.NextBytes(b) Dim h1 As Hash = Hash.SHA256(a) Dim h3 As Hash = h1.Combine(b) 'bytes combined are hashed first Assert.AreEqual(h3.ToString(), Hash.SHA256(New CombinedStream(New MemoryStream(h1.ToArray()), New MemoryStream(Hash.SHA256(b).ToArray()))).ToString()) |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
Hash ClassHash Members
Overload List